package com.xbongbong.saas.model;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.pro.businessdata.pojo.dto.FormatExplainDTO;
import com.xbongbong.pro.formdata.pojo.dto.SaasAnalysisDataDTO;
import com.xbongbong.saas.domain.entity.DistributorAccountEntity;
import java.util.List;
import java.util.Map;

/**
 * @author bomfish
 */
public interface DistributorAccountModel extends IModel<DistributorAccountEntity> {
   @Override
   Integer insert(DistributorAccountEntity entity) throws XbbException;

   void insertBatch(List<DistributorAccountEntity> list) throws XbbException;

   @Override
   List<DistributorAccountEntity> findEntitys(Map<String, Object> param);

   @Override
   Integer getEntitysCount(Map<String, Object> param);

   @Override
   Integer update(DistributorAccountEntity entity) throws XbbException;

   void updateBatch(List<DistributorAccountEntity> list) throws XbbException;

   DistributorAccountEntity getByKey(Long key, String corpid);

   String getPhoneByOpenId(String openId);

   Integer getMaxSort(String corpid, Long distributorId);

   List<DistributorAccountEntity> getByIdIn(String corpid, List<Long> idIn);

   List<DistributorAccountEntity> getByDistributorIdIn(String corpid, List<Long> distributorIdIn);

    boolean phoneRepeat(String corpid, String phone, Long dataId);

    List<DistributorAccountEntity> getAllDistributorUserList(String corpid, long distributorId, String role);

   /**
    * 获取某公司有启用中账号的经销商数量
    * @param corpid
    * @return
    */
    List<Long> getDistributorAccountNum(String corpid);

    Boolean isExists(String corpid, String phone);

    void formatUpdateExplain(FormatExplainDTO formatExplainDTO) throws XbbException;

    /**
     * 获取关联经销商名称
     * @param paasFormDataESList
     * @param corpid
     */
    void setDistributorName(List<PaasFormDataEntityExt> paasFormDataESList, String corpid);

    void formatData(SaasAnalysisDataDTO saasAnalysisDataDTO, JSONObject result) throws XbbException;
}
